package com.tgy.skiplist;

import java.util.Random;

/**
 * @Author: tgy
 * @Date: 2020-11-19 16:39
 */
public class SkipListTest {

    public static void main(String[] args) {

//        test02();
        test01();
    }

    public static void test02() {
        SkipList<Integer, Integer> skipList = new SkipList<>();
        skipList.put(5,5);
        skipList.put(4,4);
        skipList.put(8,8);
        skipList.put(7,7);
        skipList.put(1,1);
        skipList.put(2,2);

        skipList.printSkipList();

        skipList.remove(2);
        System.out.println("************************");
        skipList.printSkipList();
    }

    public static void test01() {

        SkipList<Integer, String> skipList = new SkipList<>();

        Random random = new Random();
        int findNum = 0;
        for (int i = 0; i < 10000000; i++) {
            int nextInt = random.nextInt(100000000);
            skipList.put(nextInt,String.valueOf(nextInt));

            if (i == 100) {
                System.out.println(nextInt);
                findNum = nextInt;
            }
        }


        skipList.printSkipList();
        skipList.remove(findNum);
        System.out.println("\n************************\n");
        skipList.printSkipList();


    }
}
